package com.fy.fyzf.presenter;

import com.fy.fyzf.api.SubscriberCallBack;
import com.fy.fyzf.base.BasePresenter;
import com.fy.fyzf.bean.MessageListBean;
import com.fy.fyzf.bean.BaseData;
import com.fy.fyzf.view.MessageCallback;

public class MessagePresenter extends BasePresenter<MessageCallback> {

    public MessagePresenter(MessageCallback view) {
        super(view);
    }

    public void getMessageList(int page,int pageSize){
        addSubscription(mApiService.getMessageList(page, pageSize), new SubscriberCallBack<BaseData<MessageListBean>>(mView,true) {
            @Override
            protected void onSuccess(BaseData<MessageListBean> response) {
                mView.getMessageSuccess(response.data);
            }

            @Override
            protected void onError() {

            }
        });
    }

    public void updateMsgForRead(int id){
        addSubscription(mApiService.updateMsgForRead(id), new SubscriberCallBack<BaseData>(mView,false) {
            @Override
            protected void onSuccess(BaseData response) {

            }

            @Override
            protected void onError() {

            }
        });
    }

    public void deleteMsg(int id){
        addSubscription(mApiService.deleteMsg(id), new SubscriberCallBack<BaseData>(mView,false) {
            @Override
            protected void onSuccess(BaseData response) {

            }

            @Override
            protected void onError() {

            }
        });
    }
}
